package com.spring.blog.common.util;

import com.spring.blog.pojo.dataobject.BlogInfo;
import com.spring.blog.pojo.dataobject.UserInfo;
import com.spring.blog.pojo.response.BlogInfoResponse;
import com.spring.blog.pojo.response.GetUserInfoResponse;
import org.springframework.beans.BeanUtils;

public class BeanTransUtils {
    public static BlogInfoResponse trans(BlogInfo blogInfo) {
        if(blogInfo==null){
            return null;
        }
        BlogInfoResponse blogInfoResponse=new BlogInfoResponse();
        BeanUtils.copyProperties(blogInfo,blogInfoResponse);
        return blogInfoResponse;

    }
    public static GetUserInfoResponse transgetuserinforesponse(UserInfo userInfo) {
        if(userInfo==null){
            return null;
        }
        GetUserInfoResponse getUserInfoResponse=new GetUserInfoResponse();
        BeanUtils.copyProperties(userInfo,getUserInfoResponse);
        return getUserInfoResponse;

    }

}
